package com.hellogood.work.evaluate.server.serviceImpl;

import java.util.List;

import com.google.gwt.user.server.rpc.RemoteServiceServlet;
import com.hellogood.work.evaluate.server.dao.ItemDAO;
import com.hellogood.work.evaluate.shared.po.Item;
import com.hellogood.work.evaluate.shared.services.ItemService;

public class ItemServiceImpl extends RemoteServiceServlet implements ItemService {

	private static final long serialVersionUID = -6344917508602248218L;

	@Override
	public List<Item> getList() {
		ItemDAO dao = new ItemDAO();
		return dao.getList();
	}

	@Override
	public int getTotalNumber() {
		// TODO Auto-generated method stub
		return 0;
	}

	@Override
	public String modify(Item item, boolean isModiy) {
		ItemDAO dao = new ItemDAO();
		if (!isModiy) {
			if (dao.getItem(item.getItemCode()) != null) {
				return "产品编号：" + item.getItemCode() + "已经存在";
			}
		}
		return dao.modify(item, isModiy);
	}

}
